package com.zp.mapper;

import com.zp.domain.ConfigInfo;
import com.zp.dto.request.ConfigReq;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author zp
 * @description
 * @created 2021/12/1 14:42
 */

public interface ConfigInfoMapper {
    @Insert("insert into config_info(data_id,md5,content) values(#{dataId},#{md5},#{content})")
    boolean addConfig(ConfigInfo configInfo);

    @Select("select id,data_id dataId,content,md5 from config_info where data_id=#{dataId}")
    ConfigInfo getConfig(String dataId);

    @Select("select id,data_id dataId,content,md5 from config_info where data_id=#{dataId} and md5=#{md5}")
    ConfigInfo checkConfig(@Param("dataId") String dataId, @Param("md5") String md5);

    @Update("update config_info set content=#{content},md5=#{md5} where data_id=#{dataId}")
    boolean updateConfig(ConfigInfo configInfo);

    @Select("select id,data_id dataId,content,md5 from config_info")
    List<ConfigInfo> getAllConfig();
}
